package cn.smile.business.core.impl;

import cn.smile.bean.dto.core.NotebookCount;
import cn.smile.business.core.IHomeService;
import cn.smile.business.notebook.INotebookService;
import cn.smile.utils.UserUtil;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class HomeServiceImpl implements IHomeService {
    @Resource
    private INotebookService notebookService;

    @Override
    public NotebookCount countNotebook() {
        log.info("[HomeServiceImpl].[countNotebook] ------> 统计日记相关数据 Start");
        NotebookCount entity = new NotebookCount();
        entity.setRecordDayNum(notebookService.countRecordDay(UserUtil.getUserInfo().getId()));
        entity.setMyRecordNum(notebookService.countNotebookNum(UserUtil.getUserInfo().getId()));
        entity.setShareMeNum(notebookService.shareNumToUser(UserUtil.getUserInfo().getId()));
        log.info("[HomeServiceImpl].[countNotebook] ------> 统计日记相关数据 End");
        return entity;
    }
}
